<?php

class Nuo_Form_Decorator_FormVerticalTab extends Zend_Form_Decorator_Abstract
{
	public function render($content)
	{
		$form = $this -> getElement();

		if (!$form instanceof Zend_Form)
		{
			return $content;
		}

		$elements = $form -> getElements();
		$xhtml = array();
		
		// befor table
		$xhtml[] = '<div class="vertical-tabs-list">';
		foreach ($elements as $element)
		{
			$label = null;
			$desc = null;
			
			if (method_exists($element, 'getLabel'))
			{

				$label = $element -> getLabel();
			}

			if (method_exists($element, 'getDescription'))
			{
				$desc = $element -> getDescription();
			}

			$xhtml[] = '<div class="vtab">';
			$xhtml[] = '<div class="vtab-desc">'.$label.'</div>';
			$xhtml[] = '<p class="vtab-desc">'.$desc.'</p>';
			$xhtml[] = '</div>';
			
		}
		$xhtml[] = '</div>';

		return implode(PHP_EOL, $xhtml) . '<div class="vertical-tabs-content">'. $content . '</div><div class="clear-fix"></div>';
	}

}
